#ifndef SHELF_H
#define SHELF_H

#include <QObject>
#include <QMutex>
#include <QVector>

class Shelf : public QObject
{
    Q_OBJECT

    QVector<int> books_;
    QVector<QMutex*> mutexes_;

    QMutex placingMutex_;
    int capacity_;
public:
    explicit Shelf(int count, QObject *parent = 0);
    int tryToPlaceBook();
    void returnBook(int position);
    void takeForEdit(int position);
    bool takeForReading(int position);
    size_t size();
    void returnFromEdit(int position);
signals:
    void wrotedBook(); 
    void waitForEdit();    
    void doneEdit();    
    public slots:
    
};

#endif // SHELF_H
